package o;

import android.text.TextUtils;
import android.view.View;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.huawei.appmarket.service.exposure.bean.ExposureDetail;
import com.huawei.appmarket.service.interactive.bean.InteractiveRecommItemCardBean;
import java.util.ArrayList;
import java.util.List;

public class ebm {
    private LinearLayoutManager ˋ;
    private List<InteractiveRecommItemCardBean> ॱ;

    public ebm(LinearLayoutManager linearLayoutManager) {
        this.ˋ = linearLayoutManager;
    }

    public void ˋ(List<InteractiveRecommItemCardBean> list) {
        this.ॱ = list;
    }

    public void ˋ(String str, int i, RecyclerView recyclerView) {
        Logger.ˏ("InteracExposure", "caclutExpose");
        Object ˋ = ˋ(recyclerView);
        if (!CollectCheck.isEmpty(ˋ)) {
            ExposureDetail exposureDetail = new ExposureDetail();
            exposureDetail.ˎ(ˋ);
            exposureDetail.ॱ(str);
            exposureDetail.ˏ(System.currentTimeMillis());
            dyg.ॱ().ˎ(exposureDetail, i);
        }
    }

    public ArrayList<String> ˋ(RecyclerView recyclerView) {
        int i;
        Exception e;
        int i2 = -1;
        if (CollectCheck.isEmpty(this.ॱ)) {
            return null;
        }
        if (this.ˋ == null) {
            return null;
        }
        if (evt.ˊ(recyclerView) < 50) {
            return null;
        }
        int ॱˊ;
        try {
            ॱˊ = this.ˋ.ॱˊ();
            try {
                i = ॱˊ;
                ॱˊ = this.ˋ.ʻॱ();
            } catch (Exception e2) {
                e = e2;
                Logger.ˋ("InteracExposure", "findFirstVisibleItemPosition error:" + e.toString());
                i = ॱˊ;
                ॱˊ = i2;
                if (i >= 0) {
                }
                Logger.ˋ("InteracExposure", "startPosition < 0 || endPosition < 0");
                return null;
            }
        } catch (Exception e3) {
            e = e3;
            ॱˊ = i2;
            Logger.ˋ("InteracExposure", "findFirstVisibleItemPosition error:" + e.toString());
            i = ॱˊ;
            ॱˊ = i2;
            if (i >= 0) {
            }
            Logger.ˋ("InteracExposure", "startPosition < 0 || endPosition < 0");
            return null;
        }
        if (i >= 0 || ॱˊ < 0) {
            Logger.ˋ("InteracExposure", "startPosition < 0 || endPosition < 0");
            return null;
        } else if (i == ॱˊ && evt.ˊ(ˎ(i)) < 50) {
            return null;
        } else {
            if (evt.ˊ(ˎ(i)) < 50) {
                i++;
            }
            if (evt.ˊ(ˎ(ॱˊ)) < 50) {
                ॱˊ--;
            }
            return ˏ(i, ॱˊ);
        }
    }

    private View ˎ(int i) {
        View view = null;
        if (this.ˋ != null) {
            try {
                view = this.ˋ.ˋ(i);
            } catch (Exception e) {
                Logger.ˋ("InteracExposure", "getViewByPosition error:" + e.toString());
            }
        }
        return view;
    }

    private ArrayList<String> ˏ(int i, int i2) {
        if (CollectCheck.isEmpty(this.ॱ)) {
            return new ArrayList();
        }
        ArrayList<String> arrayList = new ArrayList();
        while (i <= i2 && i < this.ॱ.size()) {
            CharSequence ॱॱ = this.ॱ.get(i) == null ? "" : ((InteractiveRecommItemCardBean) this.ॱ.get(i)).ॱॱ();
            if (TextUtils.isEmpty(ॱॱ)) {
                Logger.ˋ("InteracExposure", "The " + i + " item name is null.");
            } else {
                arrayList.add(ॱॱ);
            }
            i++;
        }
        return arrayList;
    }
}
